<?php
class menu
{
	public function makeMenu()
	{
            $query = mysql_query('SELECT * FROM menu_hoofdstuk');
            $return = '<div>';
            while($hoofdstuk = mysql_fetch_row($query)){
                $return .= '<tr class="menuMain"><div onclick="unfold(' . $hoofdstuk[0] . ')">' . $hoofdstuk[1] . '<img src="images/plus.png" width="15" height="15" id="' . $hoofdstuk[0] . 'img" class="menuMainImg"></div></tr>';
                $SQL2 = "SELECT name, link FROM menu_subhoofdstuk WHERE menu_hoofdstuk_idmenu_hoofdstuk = " . $hoofdstuk[0];
                $query2 = mysql_query($SQL2);
                $return = $return . "<tr><div class='menuSub' id='" . $hoofdstuk[0] . "'>";
                while($subhoofdstuk = mysql_fetch_row($query2)){
                    $return .= "<a href='index.php?page=" . $subhoofdstuk[0] . "'>" . $subhoofdstuk[0] . "</a><br />";
                }
            }
            echo $return;
	}
        
        public function makeExtraMenu(){
            $query = mysql_query('SELECT img, name, link FROM menu_extra');
            $return = '';
            while($menuItem = mysql_fetch_row($query)){
                $return .='<tr><td><a href="' . $menuItem[2] . '"><img src="' . $menuItem[0] . '"></a></td><td class="splitline"></td><td><a href="' . $menuItem[2] . '">' . $menuItem[1] . '</a></td></tr>';
            }
                echo $return;
        }
	
	
}
?>